package com.imooc.distributedemo.resume;

import java.util.concurrent.TimeUnit;

public class DaemonThreadTest {
    public static void main(String[] args) {
        Thread t = new Thread(new ADaemon());
        // 打开下面这个setDaemon  守护线程， 不执行子线程里面的finally
        //t.setDaemon(true);
        t.start();
    }
}

class ADaemon implements Runnable{

    @Override
    public void run() {
        try{
            System.out.println("Starting ADaemon");
            TimeUnit.SECONDS.sleep(1);
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            System.out.println("run or not?");
        }
    }
}
